#

| Chapter 20 Program Debugging |

## trace

    trace [restriction] [if cond]

Report tracing information as program is executed, according to the `restriction`. With no arguments, all source lines are printed before being executed. `cond` is a Boolean expression; if it evaluates to false, then the tracing information is not printed.

### Restriction

in `func`

  Report while executing `func`.

inclass `class`

  Print name of function that called any member of `class`.

infunction `func`

  Print name of function that called any top-level C++ `func`.

inmethod `member`

  Print name of function that called `member` of any class.

`expr` at `n`

  Print value of `expr` each time line `n` is reached.

`func`

  Print name of function that called `func`.

`n`

  Show source line `n` before executing it.

`var`

  Print value of `var` each time it changes.

`var` [in `func`]

  Same as above, but print information only while executing from within the specified procedure or function.

Reference: stopi |  | Reference: tracei